#include "Employee.h"
#include <iostream>
#include <vector>
#include <map>

using namespace std;
using namespace records;

Employee::Employee(int s, string n) : salary(s), name(n) {
}

Employee::Employee() {
    cout << "hello" << endl;
}

//aEmployee::Employee(){
//
//}
void Employee::setSalary(int s) {
    this->salary = s;
}

void Employee::setName(std::string name) {
    this->name = name;
}

int Employee::getSalary() const {
    return salary;
}

string Employee::getName() const {
    return name;
}

bool containsDuplicate(vector<int> &nums) {
    map<int, int> m;
    for (int i = 0; i < nums.size(); ++i) {
        if (m.count(nums[i]) >= 1) { //等于1说明之前已经添加过
            return true;
        } else {
            m.insert(pair<int, int>(nums[i], 0));
        }
    }
    return false;
}

int main() {
    //Employee employee(11, "asf");
    ////employee.setName("张三");
    ////employee.setSalary(22);
    //cout << employee.getName() << "--" << employee.getSalary() << endl;
    //
    //string s = "hello";
    //const char *ptr = s.c_str();
    ////ptr[0] = 'm';
    //cout << ptr << endl;


    vector<int> v = {1, 2, 3};
    if(containsDuplicate(v)) {
        cout << "success" << endl;
    }
    //for (auto iter = v.begin(); iter != v.end(); ++iter) {
    //    cout << *iter << endl;
    //}

    return 0;
}